package carmensd.vista.expedienteYvillanos

import applicationModel.EditarHobbiesVillanoAppModel
import org.uqbar.arena.layout.VerticalLayout
import org.uqbar.arena.widgets.Button
import org.uqbar.arena.widgets.Label
import org.uqbar.arena.widgets.List
import org.uqbar.arena.widgets.Panel
import org.uqbar.arena.widgets.TextBox
import org.uqbar.arena.windows.Dialog
import org.uqbar.arena.windows.WindowOwner

class EditarHobbiesWindow extends Dialog<EditarHobbiesVillanoAppModel> {

	new(WindowOwner parent, EditarHobbiesVillanoAppModel model) {
		super(parent, model)
	}

	override createContents(Panel panel) {
		this.setTitle("Editar Hobbies")
		panel.setLayout(new VerticalLayout)

		new Label(panel).setText("Hobbies:")
		new List(panel) => [
			bindItemsToProperty("villanoEnEdicion.hobbies")
			bindValueToProperty("hobbieSeleccionado")
		]

		new Button(panel) => [
			caption = "Eliminar"
			onClick [|modelObject.eliminarHobbie]
		]
		new TextBox(panel).bindValueToProperty("hobbieAAgregar")
		new Button(panel) => [
			caption = "Agregar"
			onClick [|modelObject.agregarHobbie]
		]
	}

	override protected createFormPanel(Panel mainPanel) {
		throw new UnsupportedOperationException("TODO: auto-generated method stub")
	}

}
